package com.csw.android.ffmpegtest.ui.section5

import android.os.Bundle
import android.view.View
import com.csw.android.ffmpegtest.R
import com.csw.android.ffmpegtest.databinding.LayoutSection501Binding
import com.csw.android.ffmpegtest.gl.SectionRenderer
import com.csw.android.ffmpegtest.ui.base.DataBindingFragment

/**
 * 学习 Android 平台 OpenGL ES API，了解 OpenGL 开发的基本流程，使用 OpenGL 绘制一个三角形
 *
 * OpenGl 中文学习网站
 * https://learnopengl-cn.readthedocs.io/zh/latest/
 *
 * https://www.cnblogs.com/qhyuan1992/p/6298180.html
 *
 *
 * glm opengl提供的数学库
 * https://blog.csdn.net/zhangpengzp/article/details/88714034
 *
 * 设置清屏颜色
 * https://blog.csdn.net/byhook/article/details/83716870
 */
class Section501 : DataBindingFragment<LayoutSection501Binding>() {

    override fun getContentViewID(): Int {
        return R.layout.layout_section_501
    }

    override fun initView(rootView: View, savedInstanceState: Bundle?) {
        super.initView(rootView, savedInstanceState)
        dataBinding?.glSurfaceView?.run {
            setEGLContextClientVersion(3)
            setRenderer(SectionRenderer(501))
        }
    }

    override fun onResume() {
        super.onResume()
        dataBinding?.glSurfaceView?.onResume()
    }

    override fun onPause() {
        super.onPause()
        dataBinding?.glSurfaceView?.onPause()
    }
}